using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vkItemMap : EntityTypeConfiguration<vkItem>
    {
        public vkItemMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Average_Cost, t.Item_Number, t.Item_Name });

            // Properties
            this.Property(t => t.Division)
                .HasMaxLength(30);

            this.Property(t => t.Country)
                .HasMaxLength(30);

            this.Property(t => t.SubCategory)
                .HasMaxLength(50);

            this.Property(t => t.Item_bar_code)
                .HasMaxLength(30);

            this.Property(t => t.Supplier_bar_code)
                .HasMaxLength(30);

            this.Property(t => t.Manufacture_bar_code)
                .HasMaxLength(20);

            this.Property(t => t.Category)
                .HasMaxLength(50);

            this.Property(t => t.Type)
                .HasMaxLength(25);

            this.Property(t => t.Item_Number)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Item_Name)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Class)
                .HasMaxLength(10);

            this.Property(t => t.Vendor)
                .HasMaxLength(35);

            // Table & Column Mappings
            this.ToTable("vkItem");
            this.Property(t => t.Division).HasColumnName("Division");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.SubCategory).HasColumnName("SubCategory");
            this.Property(t => t.UOM_SALES).HasColumnName("UOM SALES");
            this.Property(t => t.UOM_Orders).HasColumnName("UOM Orders");
            this.Property(t => t.FACTOR).HasColumnName("FACTOR");
            this.Property(t => t.Current_Item_Qty).HasColumnName("Current Item Qty");
            this.Property(t => t.Ordered_Item_Qty).HasColumnName("Ordered Item Qty");
            this.Property(t => t.Physical_Quantity).HasColumnName("Physical Quantity");
            this.Property(t => t.Unit_Cost).HasColumnName("Unit Cost");
            this.Property(t => t.Average_Cost).HasColumnName("Average Cost");
            this.Property(t => t.Last_Qty_Bought).HasColumnName("Last Qty Bought");
            this.Property(t => t.Last_bought_Date).HasColumnName("Last bought Date");
            this.Property(t => t.Last_Qty_Sold).HasColumnName("Last Qty Sold");
            this.Property(t => t.Last_Sold_Date).HasColumnName("Last Sold Date");
            this.Property(t => t.Adjusted_Qty).HasColumnName("Adjusted Qty");
            this.Property(t => t.Adjust_Date).HasColumnName("Adjust Date");
            this.Property(t => t.Monthly_Item_Out).HasColumnName("Monthly Item Out");
            this.Property(t => t.Monthly_Item_In).HasColumnName("Monthly Item In");
            this.Property(t => t.Monthly_Item_Adjust).HasColumnName("Monthly Item Adjust");
            this.Property(t => t.Yearly_Item_Out).HasColumnName("Yearly Item Out");
            this.Property(t => t.Yearly_Item_In).HasColumnName("Yearly Item In");
            this.Property(t => t.Yearly_Item_Adjust).HasColumnName("Yearly Item Adjust");
            this.Property(t => t.Min_Item_Qty_Allowed).HasColumnName("Min Item Qty Allowed");
            this.Property(t => t.Max_Item_Qty_Allowed).HasColumnName("Max Item Qty Allowed");
            this.Property(t => t.Item_bar_code).HasColumnName("Item bar code");
            this.Property(t => t.Supplier_bar_code).HasColumnName("Supplier bar code");
            this.Property(t => t.Manufacture_bar_code).HasColumnName("Manufacture bar code");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Physical_Date).HasColumnName("Physical Date");
            this.Property(t => t.Shipment_Mode).HasColumnName("Shipment Mode");
            this.Property(t => t.Arrival_Item_Time).HasColumnName("Arrival Item Time");
            this.Property(t => t.Min_Order_Qty).HasColumnName("Min Order Qty");
            this.Property(t => t.Last_Purchase_Currency).HasColumnName("Last Purchase Currency");
            this.Property(t => t.Last_Purchase_Date).HasColumnName("Last Purchase Date");
            this.Property(t => t.FOB_Cost).HasColumnName("FOB Cost");
            this.Property(t => t.Shipment_Cost).HasColumnName("Shipment Cost");
            this.Property(t => t.Land_Cost).HasColumnName("Land Cost");
            this.Property(t => t.Shipment_Perc_Cost).HasColumnName("Shipment Perc Cost");
            this.Property(t => t.Landed_Perc_Cost).HasColumnName("Landed Perc Cost");
            this.Property(t => t.Shipped_Cost).HasColumnName("Shipped Cost");
            this.Property(t => t.Landed_Cost).HasColumnName("Landed Cost");
            this.Property(t => t.Min_Retail_Profit).HasColumnName("Min Retail Profit");
            this.Property(t => t.Min_Whole_Profit).HasColumnName("Min Whole Profit");
            this.Property(t => t.Min_Retail_List_Price).HasColumnName("Min Retail List Price");
            this.Property(t => t.Min_Whole_List_Price).HasColumnName("Min Whole List Price");
            this.Property(t => t.Max_Retail_Perc_Discount).HasColumnName("Max Retail Perc Discount");
            this.Property(t => t.Max_Whole_Perc_Discount).HasColumnName("Max Whole Perc Discount");
            this.Property(t => t.Openning_Cost).HasColumnName("Openning Cost");
            this.Property(t => t.SALE_CURRENCY).HasColumnName("SALE CURRENCY");
            this.Property(t => t.Item_Number).HasColumnName("Item Number");
            this.Property(t => t.Item_Name).HasColumnName("Item Name");
            this.Property(t => t.Class).HasColumnName("Class");
            this.Property(t => t.Vendor).HasColumnName("Vendor");
        }
    }
}
